
import requests

# 地址
url = "https://campusgateway.51job.com/jobone-api/school/getSchoolByCity"

# 查询参数
params = {
    "pageIndex": "1",
    "pageSize": "21",
    "city": "北京"
}

# 请求头
headers = {
    "User-Agent": "Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/102.0.0.0 Safari/537.36"
}

# 请求发送，响应接收
response = requests.get(url, params=params, headers=headers)

# 提取响应
# print(response.text)

# json格式数据，可以转字典，进行key value提取
items = response.json()
for data in items['data']['records']:
    # print(data)
    name = data.get('schname')
    print(name)